Common Kernel and Rootfs builds for multiple devices with different device trees
Hi,
Sorry if this isn't a sensible question - I'm not quite familiar enough with Yocto to be sure if what I'm asking for is sensible/possible.
I'm currently building yocto (Through Xilinx Petalinux) for 4 related devices and am looking to see if we can generate a single kernel and single rootfs image for each board. At the moment each board builds as a separate Petalinux project and the combined build of all 4 takes a long time and the resulting images take up a lot of disk space.
Currently I'm not sure it's possible as there is a dependency chain from device tree -> kernel -> modules/drivers -> our custom software. This means the images are always different and the sstate cache for the kernel/drivers/custom software is only valid for the board it's built against.
Is there a way we can build one kernel for all four images even though they will all need different device trees?
Am I even asking the right question here?
Best Regards,
Phil Dawson
If the four devices have four separate MACHINE definitions in the BSP layer, then you'll have to build four different kernels.
I would look into why your custom software is dependent on the kernels and if that's really necessary. Typically userspace recipes are written in a way that their sstate output can be reused between different target machines, if those machines have the same architecture.
Alex
Quoted 25 lines · philip.dawson via lists.yoctoproject.org
Hi,
Sorry if this isn't a sensible question - I'm not quite familiar enough with Yocto to be sure if what I'm asking for is sensible/possible.
I'm currently building yocto (Through Xilinx Petalinux) for 4 related devices and am looking to see if we can generate a single kernel and single rootfs image for each board. At the moment each board builds as a separate Petalinux project and the combined build of all 4 takes a long time and the resulting images take up a lot of disk space.
Currently I'm not sure it's possible as there is a dependency chain from device tree -> kernel -> modules/drivers -> our custom software. This means the images are always different and the sstate cache for the
kernel/drivers/customsoftware is only valid for the board it's built against.Is there a way we can build one kernel for all four images even though they will all need different device trees?
Am I even asking the right question here?
Best Regards,
Phil Dawson-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63452): https://lists.yoctoproject.org/g/yocto/message/63452
Mute This Topic: https://lists.yoctoproject.org/mt/107140139/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Alex,
The four boards are all using the same MACHINE which is the petalinux default for our devices (zynqmp_generic)
Our software depends on headers from our custom kernel modules/drivers (e.g. for ioctls). If there's a better way of doing this please let me know.
Thanks,
Phil
If MACHINE is the same, how are the four different device trees inserted into the builds? Is it some petalinux-specifc mechanism?
Alex
Quoted 9 lines · philip.dawson via Lists.Yoctoproject.Org
Hi Alex,
The four boards are all using the same MACHINE which is the petalinux default for our devices (
zynqmp_generic)Our software depends on headers from our custom kernel modules/drivers (e.g. for ioctls). If there's a better way of doing this please let me know.
Thanks,
Phil
Each board is built as a separate Petalinux project with it's own Petalinux bsp.
In Yocto terms this translates into four builds in entirely separate locations (no shared TMPDIR etc).
Each build ends up with a different board specific layer (generated as part of the Petalinux BSP from a hardware description file of the SoC/FPGA) included, along with other common layers for our software. The device tree is part of this BSP layer for each board.
Thank you for your help with this,
Phil
Quoted 5 lines · Alexander Kanavin
If MACHINE is the same, how are the four different device trees inserted into the builds? Is it some petalinux-specifc mechanism?
Alex
If you're using petalinux, then you should ask for support from the petalinux provider.
On the other hand it's probably possible to transition to a direct yocto build using only standard yocto upstream mechanisms, without all the extra custom BSP generation, and then you'd be better able to control how the build gets constructed, and to get help with that in this forum.
Alex
Quoted 16 lines · philip.dawson via Lists.Yoctoproject.Org
Each board is built as a separate Petalinux project with it's own Petalinux bsp.
In Yocto terms this translates into four builds in entirely separate locations (no shared TMPDIR etc).
Each build ends up with a different board specific layer (generated as part of the Petalinux BSP from a hardware description file of the SoC/FPGA) included, along with other common layers for our software. The device tree is part of this BSP layer for each board.Thank you for your help with this,
PhilOn Wed, Jul 10, 2024 at 01:46 PM, Alexander Kanavin wrote:
If MACHINE is the same, how are the four different device trees inserted into the builds? Is it some petalinux-specifc mechanism?
Alex
OK, thank you for your help. I'll ask on the Xilinx forums.
Out of interest if I was to work to extract ourselves from Petalinux, do you have any brief idea how you might go about supporting 4 device trees -> 1 kernel if this was a pure Yocto build? Or if that's not sensible how to break the kernel driver header -> user-space dependency that's causing us to have to recompile our software?
Best Regards,
Phil
Quoted 11 lines · Alexander Kanavin
If you're using petalinux, then you should ask for support from the petalinux provider.
On the other hand it's probably possible to transition to a direct yocto build using only standard yocto upstream mechanisms, without all the extra custom BSP generation, and then you'd be better able to control how the build gets constructed, and to get help with that in this forum.
Alex
I suspect with plain Yocto, you're simply going to have one build for everything and an image that boots everywhere, with MACHINE set to zynqmp_generic. You need to try and see.
Alex
Quoted 20 lines · philip.dawson via Lists.Yoctoproject.Org
OK, thank you for your help. I'll ask on the Xilinx forums.
Out of interest if I was to work to extract ourselves from Petalinux, do you have any brief idea how you might go about supporting 4 device trees -> 1 kernel if this was a pure Yocto build? Or if that's not sensible how to break the kernel driver header -> user-space dependency that's causing us to have to recompile our software?
Best Regards,
PhilOn Wed, Jul 10, 2024 at 02:19 PM, Alexander Kanavin wrote:
If you're using petalinux, then you should ask for support from the petalinux provider.
On the other hand it's probably possible to transition to a direct yocto build using only standard yocto upstream mechanisms, without all the extra custom BSP generation, and then you'd be better able to control how the build gets constructed, and to get help with that in this forum.
Alex
Also look at the [email protected], they should be able to answer petalinux questions and how to migrate off petalinux.
Philip
Quoted 38 lines · Alexander Kanavin
I suspect with plain Yocto, you're simply going to have one build for everything and an image that boots everywhere, with MACHINE set to
zynqmp_generic. You need to try and see.Alex
Quoted 30 lines · philip.dawson via Lists.Yoctoproject.Org
OK, thank you for your help. I'll ask on the Xilinx forums.
Out of interest if I was to work to extract ourselves from Petalinux, do you have any brief idea how you might go about supporting 4 device trees -> 1 kernel if this was a pure Yocto build? Or if that's not sensible how to break the kernel driver header -> user-space dependency that's causing us to have to recompile our software?
Best Regards,
PhilOn Wed, Jul 10, 2024 at 02:19 PM, Alexander Kanavin wrote:
If you're using petalinux, then you should ask for support from the petalinux provider.
On the other hand it's probably possible to transition to a direct yocto build using only standard yocto upstream mechanisms, without all the extra custom BSP generation, and then you'd be better able to control how the build gets constructed, and to get help with that in this forum.
Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63461): https://lists.yoctoproject.org/g/yocto/message/63461
Mute This Topic: https://lists.yoctoproject.org/mt/107140139/384425
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Greetings Philip,
Did you ever figure it out ?
Best,
Nicolas
Hi Nicolas,
I asked the same question on the meta-xilinx list ( https://lists.yoctoproject.org/g/meta-xilinx/topic/107162406 ).
They had some helpful advice but it involved moving away from the PetaLinux build flow to a Yocto build flow which we can't do at the moment so we left it there. If you are using (or are able to move to) the yocto flow I think you might be able to get a pretty good split between board specific bits and common bits with some work.
It also looked like they are working towards something called ARM system ready that will break some of the dependency chain to help split parts/builds up. Again this requires the Yocto build flow and there wasn't a target date of when it would be ready but is worth investigating.
Best Regards,
Phil Dawson